<?php
/**
 * Base_App
 *
 * LICENSE
 *
 * This source file is subject to the new CC-GNU LGPL
 * It is available through the world-wide-web at this URL:
 * http://creativecommons.org/licenses/LGPL/2.1/
 *
 * @category   Base_App
 * @copyright  Copyright (c) 2009 Alexander fanatique* Thomas (me@alexander-thomas.net)
 * @license    http://creativecommons.org/licenses/LGPL/2.1/
 */
class Migrations_Migrations extends Base_App_Migrations{
	/**
	 * Defines the tables of the database
	 */
	protected function defineTables(){
		$userFields = array(
			array('name' => 'id', 'type' => 'bigint(20) unsigned', 'null' => 'NULL', 'extras' => "auto_increment"),
			array('name' => 'email', 'type' => "varchar(255) collate utf8_bin", 'null' => 'NOT NULL', 'extras' => ""),
			array('name' => 'name', 'type' => "varchar(255) collate utf8_bin", 'null' => 'NOT NULL', 'extras' => ""),
			array('name' => 'role', 'type' => "enum('user','administrator','guest') collate utf8_bin", 'null' => 'NOT NULL', 'extras' => ""),
			array('name' => 'confirmed', 'type' => "tinyint(1) unsigned", 'null' => 'NULL', 'extras' => "default '0'"),
			array('name' => 'modified', 'type' => "timestamp", 'null' => 'NOT NULL', 'extras' => "default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP"),
		);
		$this->createTable('users', $userFields, 'id', array('email'), array(), array(), 'MyISAM', 'utf8', 'utf8_bin', 0);
	}
	/**
	 * Defines initial content
	 */
	protected function defineInitialContent(){
		/**
		 * Users
		 */
		$this->insert('users', array('name' => 'Alexander Thomas', 'role' => 'user', 'confirmed' => 1, 'email' => 'me@alexander-thomas.net'));
		$this->insert('users', array('name' => 'Jens Naie', 'role' => 'user', 'confirmed' => 1, 'email' => 'jens@kybernaut.de'));
	}
}
?>